The present invention relates to digital image processing involving quantization of digital representations of color images.
Quantization involves reducing the set of colors available for image representation in order to reduce the size of the image data. Quantization errors should preferably be small so that image distortion would be imperceptible to a human observer. Hence, any two adjacent colors in the reduced set of colors should be indistinguishable to a human. At the same time, the reduced set of colors should itself be small in order to allow significant reduction in the image data size. These conflicting goals can be hard to balance if the quantization method must be suitable for a large gamut, e.g. the entire visible gamut (to be able to accommodate high dynamic range (HDR) images for example).
Each color can be represented by its coordinates in a color coordinate system (CCS), and each coordinate can be quantized separately. For this purpose, a reduced set of values can be defined for each coordinate. The color coordinate system can be chosen to provide luminance/chrominance separation, e.g. one coordinate for the luminance and two for the chrominance, with a larger reduced set for the luminance to accommodate high human sensitivity to luminance distortion.
The quantized image can be coded in a floating point format (with separate representation of the mantissa and the fraction) or an integer format. The integer format is preferred in those cases in which the quantized data is subjected to further processing involving arithmetic and/or logic operations because on many computers such operations are faster if the operands are in integer format.
An exemplary quantization method is described in Gregory Ward Larson, “The LogLuv Encoding for Full Gamut, High Dynamic Range Images”, Silicon Graphics, Inc. Mountain View, Calif. That method quantizes colors defined in either the CIE XYZ color coordinate system (“CCS”) or its derivative system xyY. The colors are quantized into 32-bit values, and we will refer to this method as LogLuv32. The luminance component Y is quantized into the following value:Le=└256(log2 Y+64)┘  (1)The function └•┘ is the floor, i.e. └x┘ is the largest integer not exceeding x. Le is coded as a 16-bit integer, with one bit for the sign and 15 bits for the magnitude. This logarithmic coding provides a constant or almost constant upper bound for the relative error ΔY/Y. The relative error is a good representation of the human ability to perceive luminance distortion. The upper bound for the relative error should be uniform (constant), and as large as possible, for effective reduction of the size of image data. According to the “LogLuv encoding” article cited above, the maximum error in quantization (1) is 0.27% (i.e. 0.0027) over the entire visible gamut.
For each color, the LogLuv32 method quantizes the color's chrominance coordinates x, y into a pair of 8-bit integer values ue, ve as follows:ue=└410u′┘ve=└410v′┘  (2)whereu′=4x/(−2x+12y+3)v′=9y/(−2x+12y+3)  (3)
Another quantization method for HDR images is described in Rafal Mantiuk, Karol Myszkowski, Hans-Peter Seidel, “Lossy Compression of High Dynamic Range Images and Video”, Proceedings of SPIE, Volume 6057 (2006). This method quantizes the chromatic coordinates as in (2), and quantizes the physical luminance y into a 12-bit value l(y) as follows (the physical luminance y is not the same y as in the xyY system):
                              l          ⁡                      (            y            )                          =                  {                                                                                                                a                      ·                      y                                        ⁢                                                                                  ⁢                    if                    ⁢                                                                                  ⁢                    y                                    <                                      y                    l                                                                                                                                                                  b                      ·                                              y                        c                                                              +                                          d                      ⁢                                                                                          ⁢                      if                      ⁢                                                                                          ⁢                                              y                        l                                                                              ≤                  y                  <                                      y                    h                                                                                                                                                                  e                      ·                                              log                        ⁡                                                  (                          y                          )                                                                                      ⁢                                                                                  ⁢                    if                    ⁢                                                                                  ⁢                    y                                    ≥                                      y                    h                                                                                                          (        4        )            Here a, b, c, e, yl, yh are positive constants, d and f are negative constants. Choosing non-logarithmic quantization for lower values of the physical luminance y in (4) is based on studies of human visual perception as described in the “Lossy Compression” article.